<#import "macro.html" as m>
    <@m.page_header title='主页' />

    <div class="wrapper wrapper-content gray-bg">
        <div class="row">
            <div class="col-lg-12">
                <div class="ibox float-e-margins">

                    <div class="ibox-content">
                        <h2>用户管理</h2>
                        <div class="ibox-tools">
                            <a href="/admin/addUser" class="btn btn-primary btn-xs">添加用户</a>
                        </div>
                        <table class="table table-hover ">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>用户名</th>
                                <th>名称</th>
                                <th>创建时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <#list users.content as u>
                                <tr>
                                    <td>${u.id?c}</td>
                                    <td>${u.username!!}</td>
                                    <td>${u.name!!}</td>
                                    <td>${u.createDate!!}</td>
                                    <td>
                                        <a href="/${u.username}" target="_blank" class="btn btn-primary btn-xs">查看网站</a>
                                        <a href="/admin/updUser/${u.id?c}" class="btn btn-primary btn-xs">修改</a>
                                    </td>
                                </tr>
                            </#list>
                            </tbody>
                        </table>
                        <div class="pagination" id="pagination"></div>  <!--- 分页 -->
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="/static/admin/js/jqPaginator.js"></script>
    <script>
        $(function () {
            try {
                $('#pagination').jqPaginator({
                    totalPages: ${users.totalPages},
                    visiblePages: 7,
                    currentPage: ${users.number+1},
                    first: '<li class="first"><a href="javascript:void(0);">首页</a></li>',
                    prev: '<li class="prev"><a href="javascript:void(0);"><i class="arrow arrow2"></i>上一页</a></li>',
                    next: '<li class="next"><a href="javascript:void(0);">下一页<i class="arrow arrow3"></i></a></li>',
                    last: '<li class="last"><a href="javascript:void(0);">末页</a></li>',
                    page: '<li class="page"><a href="javascript:void(0);">{{page}}</a></li>',
                    onPageChange: function (num, type) {
                        if (type == 'change') {
                            location.href = "/admin/photo?page=" + (num - 1);
                        }
                    }
                });
            } catch (e) {
            }
        });
    </script>

    <@m.page_footer />